\documentclass[a4paper,twoside]{ctexart}
\usepackage{geometry}
\geometry{margin=1cm,vmargin={0pt,1cm}}
\setlength{\topmargin}{-2cm}
\setlength{\paperheight}{23cm}
\setlength{\paperwidth}{18cm}
\setlength{\textheight}{19.6cm}
\setlength{\textwidth}{15cm}
\usepackage{makecell}
\usepackage{fancyhdr}
\usepackage{siunitx}
\usepackage{amssymb}
\usepackage{indentfirst}
\setlength{\parindent}{0.5em}

\pagenumbering{arabic}

% useful packages.
\usepackage{multirow}
\usepackage{caption}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumerate}
\usepackage{xcolor,graphicx,float,subfigure}
\usepackage{epstopdf}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{layout}
\usepackage{listings}
\usepackage{diagbox}
\lstset{language=Matlab}
\lstset{breaklines}
\lstset{extendedchars=false}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{xcolor}
\usepackage{cite}
\usepackage[numbers,sort&compress]{natbib}
\setcitestyle{open={},close={}}
%\usepackage{natbibspacing}
%\renewcommand{\refname}{}
\usepackage{anyfontsize}

% English theorem environment
\theoremstyle{definition}
\newtheorem{proposition}[section]{Proposition}
\newtheorem{corollary}[section]{Corollary}
\newtheorem{definition}{Definition}[section]
\newtheorem{remark}[section]{Remark}
\newtheorem{example}[definition]{Example}
\newtheorem{exercise}[definition]{Exercise}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}}
\renewcommand{\proofname}{\noindent Proof}
% some common command
\newcommand{\dif}{\mathrm{d}}
\newcommand{\avg}[1]{\left\langle #1 \right\rangle}
\newcommand{\pdfrac}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\op}{\odot}
\newcommand{\Eabs}{E_{\mathrm{abs}}}
\newcommand{\Erel}{E_{\mathrm{rel}}}
\newcommand{\Ediv}{\mathrm{div}}%\div是除号
\newcommand{\lrq}[1]{\left( #1 \right)}
\newcommand{\avint}[1]{\frac{1}{\left|#1\right|}\int_{#1}}

\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}} 

\makeatletter
\newcommand\sixteen{\@setfontsize\sixteen{17pt}{6}}
\renewcommand{\maketitle}{\bgroup\setlength{\parindent}{0pt}
\begin{flushleft}
\sixteen\bfseries \@title
\medskip
\end{flushleft}
\texttt{\@author}
\egroup}
\renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}
\makeatother
\setlength{\abovecaptionskip}{0.cm}
\setlength{\floatsep}{0.cm}
\setlength{\intextsep}{0.cm}

%\CTEXsetup[format={\Large\bfseries}]{section}

\title{微分方程数值解\ 第9次作业}
\author{李之琪 22235056}

\begin{document}
\maketitle
\section*{coding part}
根据(4.1.18)，有
\begin{equation}
  v^{n+1} = (I - \frac{2}{k}Q)^{-1}(I + \frac{2}{k}Q)v^n,
\end{equation}
其中$Q = \dfrac{1}{h^2}\text{Tri}(a_{j-1/2},-a_{j+1/2}-a_{j-1/2},a_{j+1/2})$
是相应的循环三对角矩阵。考虑$a(x) = 2 + \sin{x}$，初值$f(x) = \sin{x}
+ \cos{x}$。令$h = \dfrac{2\pi}{64}, k = 0.1$，终止时刻$T = 0,1,2,4$时
的结果如下图所示。\\
\begin{figure}[!htp]   
  \centering
  \includegraphics[width=12cm]{F1.eps}
  \label{fig:1}
\end{figure}\\
上图可以通过运行\texttt{main.m}得到。
\section*{4.1.1}
等式两边关于$v_j^{n+1}$作内积，有
\begin{eqnarray}
  \begin{aligned}
    (v_j^{n+1},v_j^{n+1}) &= ((I + k a_jD_+)v_j^n,v_j^{n+1})\\
    &=(v_j^n, v_j^{n+1}) + k a_j(\frac{v_j^{n+1} - v_j^{n}}{h}, v_j^{n+1}),
  \end{aligned}
\end{eqnarray}
从而
\begin{eqnarray}
  \begin{aligned}
    (1-\frac{k}{h}a_j)(v_j^{n+1},v_j^{n+1}) = (1-\frac{k}{h}a_j)(v_j^n, v_j^{n+1}).
  \end{aligned}
\end{eqnarray}
当$k < \left\|a\right\|_{\infty}h$时，有$1-\dfrac{k}{h}a_j > 0, \forall
j$。这里$\left\|a\right\|_{\infty}:= \max_j{a_j}$。此时，有
\begin{eqnarray}
  \begin{aligned}
    \left\|v^{n+1}\right\|_h^2 = (v^n, v^{n+1})_h \le \left\|v^{n}\right\|_h\left\|v^{n+1}\right\|_h,
  \end{aligned}
\end{eqnarray}
从而
\begin{eqnarray}
  \begin{aligned}
    \left\|v^{n}\right\|_h  \le \left\|v^{0}\right\|_h = \left\|f\right\|_h.
  \end{aligned}
\end{eqnarray}
上面的稳定性条件$k < \left\|a\right\|_{\infty}h$实际上就是方程$u_t =
au_x$的CFL条件。
\end{document}

